package com.example.demo.service.impl;

import com.example.demo.enity.User;
import com.example.demo.mapper.UserMapper;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


//@Service是放在实现类上的
//他的意思是告诉springboot这个类是实现接口的
//并且将这个对象（实现类生成的对象） 放在父类的引用型后面 UserService userService
//UserService userService = new UserServiceimpl()
//调用时是根据父类的引用型进行调用  UserService userService
//在将对象扫描到ico容器中 UserService userService = new UserServiceimpl()


@Service


//再调用是根据 父类引用名（型）进行调用的 将这个类的实例化对象 放在这个 引用名下面
//UserService userService = new UserServiceimpl()
public class UserServiceimpl implements UserService {

    @Autowired
    UserMapper userMapper;

//    @Override
//    public User findeByUser(User user) {
//        return userMapper.findeByUser(user);
//    }

//    @Override
//    public User findById(Integer id) {
//        return userMapper.findById(id);
//    }

//    @Override
//    public List<User> selectUserByWhere(User user) {
//        return userMapper.selectUserByWhere(user);
//    }

//    @Override
//    public int deleteUser(Integer id) {
//        return userMapper.deleteUser(id);
//    }


    @Override
    public User getUserByUsername(String username) {
        return userMapper.getUserByUsername(username);
    }

    @Override
    public List<User> selectUserList() {
        return userMapper.selectUserList();
    }

    @Override
    public User selectUserByUsername(String username) {
        return userMapper.selectUserByUsername(username);
    }

    @Override
    public int insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public User selectUserById(Integer id) {
        return userMapper.selectUserById(id);
    }

    @Override
    public int updateUser(User user) {
        return userMapper.updateUser(user);
    }

    @Override
    public int deleteUserById(Integer id) {
        return userMapper.deleteUserById(id);
    }

    @Override
    public int updateUserPassWordByUser(String password, Integer id) {
        return userMapper.updateUserPassWordByUser(password, id);
    }

}
